﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Jok.Server.Infrastructure
{
    public class LogMng
    {
        public static void WriteInformation(string Format, params object[] Params)
        {
            Write(LogLevel.Information, Format, Params);
        }
        public static void WriteWarning(string Format, params object[] Params)
        {
            Write(LogLevel.Warning, Format, Params);
        }
        public static void WriteError(string Format, params object[] Params)
        {
            Write(LogLevel.Error, Format, Params);
        }

        public static void Write(LogLevel Level, string Format, params object[] Params)
        {
            Write(Level, String.Format(Format, Params));
        }
        public static void Write(LogLevel Level, string Message)
        {
            switch (Level)
            {
                case LogLevel.Information:
                    {
                        Trace.TraceInformation(Message);
                    }
                    break;

                case LogLevel.Warning:
                    {
                        Trace.TraceWarning(Message);
                    }
                    break;

                case LogLevel.Error:
                    {
                        Trace.TraceError(Message);
                    }
                    break;
            }

        }
    }

    public enum LogLevel
    {
        Information = 0,
        Warning = 1,
        Error = 2
    }
}
